package com.coupon.constrol;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;

/**
 * @author :wn
 * @program : coupon
 * @descript : 短信验证
 * @create :2020-12-31 11:28
 */
@Controller
@RequestMapping("/captcha")
public class SmsController {
    @RequestMapping("/send")
    public void send(@RequestParam("phone") String phone, HttpSession session){
        StringBuilder builder = new StringBuilder("");

        for (int i = 0; i < 4; i++) {

            builder.append((int)(Math.random()*9+1));
        }
        session.setAttribute("code",builder.toString());
        System.out.println("服务器保存的code"+builder.toString());



    }
}
